package com.weishuang.monitor.leader.controller;


import com.weishuang.monitor.leader.commons.entity.Result;
import com.weishuang.monitor.leader.commons.utils.ResultUtils;
import com.weishuang.monitor.leader.service.ISysRoleMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 角色菜单关联表 前端控制器
 * </p>
 *
 * @author weishuang
 * @since 2021-03-23
 */
@RestController
@RequestMapping("/leader/sysRoleMenu")
public class SysRoleMenuController {

    @Autowired
    private ISysRoleMenuService sysRoleMenuService;

    /**
     * 授权菜单和权限给角色
     * @param roleId
     * @param menuIds
     * @return
     */
    @PostMapping("authorizationMenuAndPermissionsToRole/{roleId}")
    public Result authorizationMenuAndPermissionsToRole(@PathVariable String roleId, String[] menuIds) {
        sysRoleMenuService.authorizationMenuToRoleAndPermissions(roleId, menuIds);
        return ResultUtils.success();
    }
}
